package com.example.player.util;

import android.animation.ValueAnimator;
import android.view.View;

/**
 * 本类用于施加动画效果
 * @author 朱文权
 * */
public class AnimationUtil {
    public static void colorAnimate(View view,int startColor,int endColor,int duration){
        ValueAnimator colorAnimator = ValueAnimator.ofArgb(startColor, endColor);
        colorAnimator.setDuration(duration);
        colorAnimator.addUpdateListener(anim -> {
            view.setBackgroundColor((int) anim.getAnimatedValue());
        });
        colorAnimator.start();
    }
}
